// ComfyOne API 基础响应类型
export interface ApiResponse<T = any> {
    code: number;
    message: string;
    data: T;
}

// 配置类型
export interface ComfyOneConfig {
    token: string;
}

// 工作流相关类型
export interface Workflow {
    id: string;
    name: string;
    description?: string;
    created_at: string;
    updated_at: string;
    content: Record<string, any>;
    status: "active" | "inactive";
}

export interface CreateWorkflowRequest {
    name: string;
    description?: string;
    content: Record<string, any>;
}

export interface UpdateWorkflowRequest {
    name?: string;
    description?: string;
    content?: Record<string, any>;
    status?: "active" | "inactive";
}

export interface TaskResult {
    images?: string[];
    videos?: string[];
    other_outputs?: Record<string, any>;
}

export interface CreateTaskRequest {
    workflow_id: string;
    inputs: Record<string, any>[];
    free_cache?: boolean;
}

export interface CreateTaskResponse {
    taskId: string;
}

export interface TaskHistoryParams {
    page?: number;
    size?: number;
    status?: "pending" | "running" | "completed" | "failed" | "cancelled";
}

// 实例相关类型
export interface Instance {
    id: string;
    name: string;
    type: string;
    status: "online" | "offline";
    specs: {
        gpu: string;
        memory: string;
        storage: string;
    };
    created_at: string;
}

export interface CreateInstanceRequest {
    name: string;
    type: string;
    specs: {
        gpu: string;
        memory: string;
        storage: string;
    };
}

export interface TaskData {
    status: string;
    images?: string[];
    message: string;
    cost_time?: number;
    position?: number;
}

export interface TaskStatusResponse {
    code: number;
    message: string;
    data: TaskData;
}

export interface User {
    id: string;
    name: string;
    email: string;
    password: string;
}

// API 响应类型
export interface WorkflowsResponse extends ApiResponse<Workflow[]> {}
export interface WorkflowResponse extends ApiResponse<Workflow> {}
export interface TaskResponse extends ApiResponse<Task> {}
export interface TaskHistoryResponse
    extends ApiResponse<{
        items: Task[];
        total: number;
        page: number;
        size: number;
    }> {}
export interface InstancesResponse extends ApiResponse<Instance[]> {}
